package com.cleaningcloud.erp.service.impl;

import com.cleaningcloud.common.core.utils.DateUtils;
import com.cleaningcloud.erp.api.domain.ErpCommodityStockAlter;
import com.cleaningcloud.erp.mapper.ErpCommodityStockAlterMapper;
import com.cleaningcloud.erp.service.IErpCommodityStockAlterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 库存商品数量变更记录Service业务层处理
 *
 * @author cleaningcloud
 * @date 2025-02-19
 */
@Service
public class ErpCommodityStockAlterServiceImpl implements IErpCommodityStockAlterService {
    @Autowired
    private ErpCommodityStockAlterMapper erpCommodityStockAlterMapper;

    /**
     * 查询库存商品数量变更记录
     *
     * @param wareCommodityNumberDayId 库存商品数量变更记录主键
     * @return 库存商品数量变更记录
     */
    @Override
    public ErpCommodityStockAlter selectErpCommodityStockAlterByWareCommodityNumberDayId(Long wareCommodityNumberDayId) {
        return erpCommodityStockAlterMapper.selectErpCommodityStockAlterByWareCommodityNumberDayId(wareCommodityNumberDayId);
    }

    /**
     * 查询库存商品数量变更记录列表
     *
     * @param erpCommodityStockAlter 库存商品数量变更记录
     * @return 库存商品数量变更记录
     */
    @Override
    public List<ErpCommodityStockAlter> selectErpCommodityStockAlterList(ErpCommodityStockAlter erpCommodityStockAlter) {
        return erpCommodityStockAlterMapper.selectErpCommodityStockAlterList(erpCommodityStockAlter);
    }

    /**
     * 新增库存商品数量变更记录
     *
     * @param erpCommodityStockAlter 库存商品数量变更记录
     * @return 结果
     */
    @Override
    public int insertErpCommodityStockAlter(ErpCommodityStockAlter erpCommodityStockAlter) {
        erpCommodityStockAlter.setCreateTime(DateUtils.getNowDate());
        return erpCommodityStockAlterMapper.insertErpCommodityStockAlter(erpCommodityStockAlter);
    }

    /**
     * 修改库存商品数量变更记录
     *
     * @param erpCommodityStockAlter 库存商品数量变更记录
     * @return 结果
     */
    @Override
    public int updateErpCommodityStockAlter(ErpCommodityStockAlter erpCommodityStockAlter) {
        return erpCommodityStockAlterMapper.updateErpCommodityStockAlter(erpCommodityStockAlter);
    }

    /**
     * 批量删除库存商品数量变更记录
     *
     * @param wareCommodityNumberDayIds 需要删除的库存商品数量变更记录主键
     * @return 结果
     */
    @Override
    public int deleteErpCommodityStockAlterByWareCommodityNumberDayIds(Long[] wareCommodityNumberDayIds) {
        return erpCommodityStockAlterMapper.deleteErpCommodityStockAlterByWareCommodityNumberDayIds(wareCommodityNumberDayIds);
    }

    /**
     * 删除库存商品数量变更记录信息
     *
     * @param wareCommodityNumberDayId 库存商品数量变更记录主键
     * @return 结果
     */
    @Override
    public int deleteErpCommodityStockAlterByWareCommodityNumberDayId(Long wareCommodityNumberDayId) {
        return erpCommodityStockAlterMapper.deleteErpCommodityStockAlterByWareCommodityNumberDayId(wareCommodityNumberDayId);
    }
}
